package br.com.sovi.mobile.j2me.gps;

import java.util.Date;
import java.util.Hashtable;
import java.util.Vector;

public class LocationRecord {

    public static Hashtable points = new Hashtable();

    public static void add(String id, Date date, double latitude, double longitude) {
        System.out.println(1);
        Vector vector = null;
        if (points.get(id) != null) {
            System.out.println(2);
            vector = (Vector) points.get(id);
        } else {
            System.out.println(3);
            vector = new Vector();
            points.put(id, vector);
        }

        System.out.println(4);
        vector.addElement(new Point(date, latitude, longitude));
        System.out.println("Size: " + vector.size());
    }

    public static Vector getById(String id) {
        return (Vector) points.get(id);
    }

    public static class Point {
        private Date date;
        private double latitude, longitude;

        public Point(Date date, double latitude, double longitude) {
            this.date = date;
            this.latitude = latitude;
            this.longitude = longitude;
        }

        public Date getDate() {
            return date;
        }

        public double getLatitude() {
            return latitude;
        }

        public double getLongitude() {
            return longitude;
        }

    }

}
